Why do we need to use @Synthesize?
1760
14-Jul-2015
Updated on 19-Sep-2020
Tarun Kumar
14-Jul-2015when you create a property...
Xcode will auto synthesise an iVar as if you had written...
This means you can access the property with...
Either will work but only
self.nameactually uses the accessor methods.There is only one time that auto synthesise does not work.
If you overwrite but the setter AND the getter method then you will need to synthesise the iVar.
You are fine if you just override the setter or if you just override the getter. But if you do both then the compiler won't understand it and you will need to synthesise it manually.
As a rule of thumb though.
Don't make iVars. Just use the property. Don't synthesise it.